<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="js/ajax.js"></script>
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.js"></script>
    <style>
        #app img{
            width: 150px;
        }
    </style>
</head>
<body>
    <div id="app"></div>
    <script>
        var id = location.search.split("=")[1];
        console.log(id)
        var url = `http://47.108.197.28:3000/playlist/detail?id=${id}`;
        console.log(url)
        $ajax({
            url,
            success:res=>{
                    var {name,coverImgUrl,description} =  res.playlist;
                    var template = `
                    
                            <div>
                                <img src = "${coverImgUrl}">
                                <p>${name}</p>
                                <p>${description}</p>
                            </div>
                       
                    `
                    $("#app").append(template)
                
            }
        })
        //  /* 1、获取id值 */
        //  var id =  location.search.split("=")[1];
        // // console.log(id)
        // /* 2、根据id值发送http请求 */
        // var url  = `http://47.108.197.28:3000/playlist/detail?id=${id}`;
        // $ajax({
        //     url,
        //     success:res=>{
        //         console.log(res.playlist)
        //         var {name,coverImgUrl,description} = res.playlist;
        //         var template = `
        //         <div>
        //             <img src='${coverImgUrl}'/>
        //             <p>${name}</p>
        //             <P>${description}</p>
        //         </div>
        //         `
        //         $("#app").append(template)
        //     }
        // })
    </script>
</body>
</html>